//
//  JSBaseViewController.m
//  JSBasicFramework
//
//  Created by Apple on 2018/8/1.
//  Copyright © 2018年 Apple. All rights reserved.
//

#import "JSBaseViewController.h"

@interface JSBaseViewController ()

@end

@implementation JSBaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)viewDidLayoutSubviews{
    [super viewDidLayoutSubviews];
    
    if (!objc_getAssociatedObject(self, _cmd)) {
        objc_setAssociatedObject(self, @selector(viewDidLayoutSubviews), @(YES), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
        [self layoutSubview];
    }
}
-(void)layoutSubview{
    self.view.backgroundColor = JS_colorWithHex(kBodyBGColor);
}

- (UICollectionView *)collectionView{
    if (!_collectionView) {
            UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
            layout.scrollDirection = UICollectionViewScrollDirectionVertical;
            //这个是水平布局
            //layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
       
        _collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
    
        _collectionView.backgroundColor = [UIColor clearColor];
    }
    return _collectionView;
}

@end
